﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using Emoney.DataAccess;
using LiuYan.Base;


namespace LiuYan.Service
{
   public class TongJiService
   {
       public DataSet GetTj()
       {
           string sql =
               "select sum(TotalPrice) as a,count(*) as b from TB_Order where Status=4 and del=0 " +
               "select sum(TotalPrice) as a,count(*) as b from TB_Order where Status=5 and del=0 ";
           return SqlHelper.ExecuteDataset(Connection.conStr, CommandType.Text, sql);
       }

       public DataSet GetMouthTj()
       {
           string sql =
               "select sum(TotalPrice) as a,count(*) as b from TB_Order where Status=4 and del=0 and datediff(MONTH,[Date],GETDATE())=0" +
               "select sum(TotalPrice) as a,count(*) as b from TB_Order where Status=5 and del=0 and datediff(MONTH,[Date],GETDATE())=0";
           return SqlHelper.ExecuteDataset(Connection.conStr, CommandType.Text, sql);
       }

       public DataSet GetWeekTj()
       {
           string sql =
               "select sum(TotalPrice) as a,count(*) as b from TB_Order where Status=4 and del=0 and datediff(week,[Date],GETDATE())=0" +
               "select sum(TotalPrice) as a,count(*) as b from TB_Order where Status=5 and del=0 and datediff(week,[Date],GETDATE())=0";
           return SqlHelper.ExecuteDataset(Connection.conStr, CommandType.Text, sql);
       }

       public DataSet GetDayTj()
       {
           string sql =
                         "select sum(TotalPrice) as a,count(*) as b from TB_Order where Status=4 and del=0 and datediff(day,[Date],GETDATE())=0" +
                         "select sum(TotalPrice) as a,count(*) as b from TB_Order where Status=5 and del=0 and datediff(day,[Date],GETDATE())=0";
           return SqlHelper.ExecuteDataset(Connection.conStr, CommandType.Text, sql);
       }
       public DataSet GetYearTj()
       {
           string sql =
                         "select sum(TotalPrice) as a,count(*) as b from TB_Order where Status=4 and del=0 and datediff(year,[Date],GETDATE())=0" +
                         "select sum(TotalPrice) as a,count(*) as b from TB_Order where Status=5 and del=0 and datediff(year,[Date],GETDATE())=0";
           return SqlHelper.ExecuteDataset(Connection.conStr, CommandType.Text, sql);
       }
   }
}
